using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.Serialization;

namespace PSE.Hosting.ServiceHoster.Entities
{
    /// <summary>
    /// Represents a WCF Service Entity
    /// </summary>
    [DataContract]
    public class Service
    {
        #region Fields

        private string _name;       // The service name
        private bool _isAlive;      // Indicates whether the service is alive
        private string _assembly;   // The assembly name of the service
        private string _codeBase;   // A full description or reference to the assembly
        private string _mexAddress; // The metadata exchange (MEX) endpoint address of the service.
        private bool _isValid;      // Indicates whether the service is valid

        #endregion

        #region Constructors

        /// <summary>
        /// Creates a new instance of the 
        /// <see cref="PSE.Hosting.ServiceHoster.Entities.Service"/> class.
        /// </summary>
        public Service()
        {
        }

        /// <summary>
        /// Creates a new instance of the 
        /// <see cref="PSE.Hosting.ServiceHoster.Entities.Service"/> class.
        /// </summary>
        /// <param name="name">The service name.</param>
        /// <param name="isAlive">Indicates whether the service is alive.</param>
        /// <param name="assembly">The assembly name of the service.</param>
        /// <param name="codeBase">A full description or reference to the assembly.</param>
        /// <param name="isValid">Indicates whether the service is valid.</param>
        public Service(string name, bool isAlive, string assembly, string codeBase, string mexAddress, bool isValid)
        {
            _name = name;
            _isAlive = isAlive;
            _assembly = assembly;
            _codeBase = codeBase;
            _mexAddress = mexAddress;
            _isValid = isValid;
        }

        #endregion

        #region Properties

        /// <summary>
        /// The service name.
        /// </summary>
        [DataMember]
        public string Name
        {
            get { return _name; }
            set { _name = value; }
        }

        /// <summary>
        /// Indicates whether the service is alive.
        /// </summary>
        [DataMember]
        public bool IsAlive
        {
            get { return _isAlive; }
            set { _isAlive = value; }
        }

        /// <summary>
        /// The assembly name of the service.
        /// </summary>
        [DataMember]
        public string Assembly
        {
            get { return _assembly; }
            set { _assembly = value; }
        }

        /// <summary>
        /// A full description or reference to the assembly.
        /// </summary>
        [DataMember]
        public string CodeBase
        {
            get { return _codeBase; }
            set { _codeBase = value; }
        }

        /// <summary>
        /// The metadata exchange (MEX) endpoint address of the service.
        /// </summary>
        [DataMember]
        public string MexAddress
        {
            get { return _mexAddress; }
            set { _mexAddress = value; }
        }

        /// <summary>
        /// Indicates whether the service is valid.
        /// </summary>
        [DataMember]
        public bool IsValid
        {
            get { return _isValid; }
            set { _isValid = value; }
        }

        #endregion 
    }
}
